<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ page import="entity.Owner" %>
        <%@ page import="entity.FeeType" %>
            <%@ page import="dao.FeeTypeDao" %>
                <%@ page import="java.util.List" %>
                    <html>

                    <head>
                        <title>收费标准查询</title>
                        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
                            rel="stylesheet">
                        <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css"
                            rel="stylesheet">
                        <style>
                            body {
                                background-color: #f8f9fa;
                                padding-top: 2rem;
                            }

                            .card {
                                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                                border: none;
                            }

                            .table {
                                margin-bottom: 0;
                            }

                            .back-link {
                                text-decoration: none;
                                color: #6c757d;
                                display: inline-flex;
                                align-items: center;
                                gap: 0.5rem;
                            }

                            .back-link:hover {
                                color: #495057;
                            }
                        </style>
                    </head>

                    <body>
                        <% Owner owner=(Owner) session.getAttribute("owner"); if (owner==null) {
                            response.sendRedirect("login.jsp"); return; } FeeTypeDao feeTypeDao=new FeeTypeDao();
                            List<FeeType> feeTypes = feeTypeDao.getAllFeeTypes();
                            %>

                            <div class="container">
                                <div class="row justify-content-center">
                                    <div class="col-md-8">
                                        <a href="index.jsp" class="back-link mb-3 d-inline-block">
                                            <i class="bi bi-arrow-left"></i> 返回首页
                                        </a>

                                        <div class="card">
                                            <div class="card-body">
                                                <h2 class="card-title text-center mb-4">收费标准查询</h2>
                                                <div class="table-responsive">
                                                    <table class="table table-hover">
                                                        <thead class="table-light">
                                                            <tr>
                                                                <th>费用类型</th>
                                                                <th>单价</th>
                                                                <th>计费单位</th>
                                                                <th>说明</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <% for (FeeType feeType : feeTypes) { %>
                                                                <tr>
                                                                    <td>
                                                                        <%= feeType.getName() %>
                                                                    </td>
                                                                    <td>
                                                                        <%= feeType.getPrice() %>
                                                                    </td>
                                                                    <td>
                                                                        <%= feeType.getUnit() %>
                                                                    </td>
                                                                    <td>
                                                                        <%= feeType.getDescription() !=null ?
                                                                            feeType.getDescription() : "" %>
                                                                    </td>
                                                                </tr>
                                                                <% } %>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script
                                src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
                    </body>

                    </html>